package com.power.dao;

import com.power.pojo.Roles;
import com.power.pojo.Users;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * Created with IntelliJ IDEA.
 * User: 朱雄
 * Date: 2020/10/04 23:00
 * Description:
 * Version: V1.0
 */
public interface UserDao {
    /**
     *
     * @param user_account
     * @param old_pwd
     * @return
     */
    List<Map<String, Object>> findByAccount(String user_account, String old_pwd) throws SQLException;

    /**
     * 修改个人信息
     * @param users
     * @return
     */
    int userUpdate(Users users) throws SQLException;

    /**
     * 查询所有角色
     * @return
     */
    List<Map<String, Object>> queryRole() throws SQLException;

    /**
     * 修改角色
     * @param roles
     * @return
     */
    int roleUpdate(Roles roles) throws SQLException;

    /**
     * 判断用户是否唯一
     * @param roleName
     * @return
     */
    int findByRoleName(String roleName) throws SQLException;

    /**
     * 添加角色
     * @param roleName
     * @param date
     * @return
     */
    int addRole(String roleName, Date date) throws SQLException;

    /**
     * 角色条件查询
     * @param roleName
     * @param roleStatee
     * @return
     */
    List<Map<String, Object>> queryByNameAndState(String roleName, String roleStatee) throws SQLException;

    /**
     * 用户查询
     * @param page
     * @param limit
     * @return
     */
    List<Map<String, Object>> userQuery(String page, String limit) throws SQLException;

    /**
     * 用户条数
     * @return
     */
    int userCount() throws SQLException;

    /**
     * 修改用户
     * @param users
     * @return
     */
    int updateUser(Users users) throws SQLException;

    /**
     * 添加用户
     * @param users
     * @return
     */
    int addUser(Users users) throws SQLException;

    /**
     * 条件查询
     * @param user_name
     * @param user_state
     * @param page
     * @param limit
     * @return
     */
    List<Map<String, Object>> queryByUser(String user_name, String user_state, String page, String limit) throws SQLException;

    /**
     * 查询的总条数
     * @param user_name
     * @param user_state
     * @return
     */
    int queryByUserCount(String user_name, String user_state) throws SQLException;

    /**
     * 删除用户
     * @param userAccount
     * @return
     */
    int deleteUser(String userAccount) throws SQLException;

    /**
     * 判断用户账号是否重复
     * @param userAccount
     * @return
     */
    List<Map<String, Object>> judgeUserAcc(String userAccount) throws SQLException;

    /**
     * 查询所有权限
     * @param roleId
     * @return
     */
    List<Map<String, Object>> queryAuthorityAll(String roleId) throws SQLException;

    /**
     *
     * @return
     */
    List<Map<String, Object>> queryAuthorityAll2() throws SQLException;

    /**
     * 权限修改
     * @param roleId
     * @param list
     * @return
     */
    int updateAuthority(String roleId, List<Map> list) throws SQLException;
}
